function setItem(key,value) {
    try {
        let val = JSON.stringify(value);
        localStorage.setItem(key, val);
    }catch (e) {
        console.error(e)
        return false;
    }
    return true;
}

function getItem(key){
    let val = JSON.parse(localStorage.getItem(key));
    return val;
}

function remove(key){
    localStorage.removeItem(key);
}

export const LocalStorageHelper = {
    setItem,
    getItem,
    remove
}

export default LocalStorageHelper;